package com.tank.dubbo.service.consumer;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA.
 * User: SuQiEr
 * Date:2017/9/29
 * Time: 14:30
 * To change this template use File | Settings | File Templates.
 */
@Aspect
@Component
public class PerformenceMonitor {

    /**
     * 监控com.henry.advertising.web.service包及其子包的所有public方法
     * <功能详细描述>
     * @see [类、类#方法、类#成员]
     */
    @Pointcut("execution(* com.tank.dubbo.service.consumer.*.*(..))")
    private void pointCutMethod() {
    }
        // com.alibaba.dubbo.common.bytecode.proxy0
    //com.alibaba.dubbo.config.ApplicationConfig
    //com.alibaba.dubbo.rpc.protocol.dubbo
    //声明环绕通知
  //  @Around("pointCutMethod()")
    public Object doAround(ProceedingJoinPoint pjp) throws Throwable {
        long begin = System.nanoTime();
        Object o = pjp.proceed();
        long end = System.nanoTime();
        System.out.println("类名:"+pjp.getTarget().getClass()+" 方法:"+pjp.getSignature().getName());
        return o;
    }
}
